# -*- coding:utf-8 -*-
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None
class Solution:
    def Print(self, pRoot):
        # write code here
        if not pRoot :
            return []
        nodes = [pRoot]
        res = [[pRoot.val]]


        while nodes:
            layer_res = []
            for node in nodes:
                if node.left:
                    layer_res.append(node.left)
                if node.right:
                    layer_res.append(node.right)

            res.append([item.val for item in layer_res])


            nodes = layer_res

        return res[:-1]